/*
 * The class is used tho loader the source binary code image, and set the simulate stack.
 */ 
#ifndef ELFMEMORYIMAGE_H
#define ELFMEMORYIMAGE_H

#include "crossbit/common.h"
#include "crossbit/MemoryImage.h"
#include "crossbit/UTIL.h"
#include "crossbit/GLOBAL.h"

namespace crossbit {

    class ELFMemoryImage: public MemoryImage {
        public:

            ELFMemoryImage(	XTPStr pathname, 
                    XTUint32 argc, 
                    XTPStr argv[],
                    XTPStr envp[] );

            virtual ~ELFMemoryImage();

            // Load the ECOFF binary image into this Image
            virtual bool load();

            // Map the src address to target address, actually if the source code image is loaded to the same location
            // as it requireced, this method will return <code>src</code> directlly.
            virtual XTMemAddr map(XTMemAddr src);

        protected:
            // set up the simulated stack for the source process
            virtual XTMemAddr setupStack(XTMemAddr base);
            // a const variable identify the max environemnt variable that could be set
            static const XTUint32 MAX_ENVIRON = 16384;
    };
}

#endif	//ELFMEMORYIMAGE_H

